all:clean interupt.c start.S drv/LedDrv.c drv/NandDrv.c drv/UartDrv.c main.c common/commlib.c common/eventQueue.c drv/KeyDrv.c
	@arm-linux-gcc -nostdlib -c -g -o interupt.o interupt.c -Idrv -I. -Icommon
	@arm-linux-gcc -nostdlib -c -g -o LedDrv.o drv/LedDrv.c -Idrv
	@arm-linux-gcc -nostdlib -c -g -o start.o start.S -Idrv
	@arm-linux-gcc -nostdlib -c -g -o NandDrv.o drv/NandDrv.c -Idrv
	@arm-linux-gcc -nostdlib -c -g -o sub_start.o sub_start.c -Idrv -I.
	@arm-linux-gcc -nostdlib -c -g -o UartDrv.o drv/UartDrv.c -Idrv -I. -Icommon
	@arm-linux-gcc -nostdlib -c -g -o KeyDrv.o drv/KeyDrv.c -Idrv -I. -Icommon
	@arm-linux-gcc -nostdlib -c -g -o commlib.o common/commlib.c
	@arm-linux-gcc -nostdlib -c -g -o eventQueue.o common/eventQueue.c
	@arm-linux-gcc -nostdlib -c -g -o main.o main.c -Idrv -Icommon	
	@arm-linux-ld -T nand.lds -o nand.elf start.o sub_start.o LedDrv.o interupt.o UartDrv.o main.o commlib.o eventQueue.o KeyDrv.o
	@arm-linux-objcopy -O binary nand.elf nand.bin
	@arm-linux-objdump -D -m arm nand.elf > nand.dis
	@#cp -r $(shell pwd) /mnt/hgfs/as/
	@rm -rf *.o *~
	@echo done\(./nand.bin\)

clean:
	@rm -rf *.o *.elf *.bin *.dis *~
